﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Include/Admin.master" AutoEventWireup="true"
    CodeFile="Manage.aspx.cs" Inherits="Admin_AdminNava_Manage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script language="javascript" type="text/javascript">
        function checkAll(id) {
            var parentcheckbox = document.getElementById(id);
            var div = document.getElementById(id + "div");
            var check = div.getElementsByTagName("input");
            for (i = 0; i < check.length; i++) {
                if (check[i].type == "checkbox")
                    check[i].checked = parentcheckbox.checked;
            }
        }

        function GetAll() {
            var s = "";
            var checkNava = document.getElementsByName("cb");
            for (i = 0; i < checkNava.length; i++) {
                if (checkNava[i].checked)
                    s = s + checkNava[i].value + "_";
            }
            document.getElementById("<%=hdlNavaAll.ClientID %>").value = s;
        }
        function ReturnNavaChek() {
            var NavList = "<%=NavaAll%>";
            if (NavList != null) {
                var list = NavList.split('_');
                for (i = 0; i < list.length - 1; i++) {
                    if (document.getElementById(list[i]))
                        document.getElementById(list[i]).checked = true;
                }
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table cellspacing="0" cellpadding="0" style="width: 100%; height: 30px; padding-bottom: 5px;
        border: 1px; border-color: #66CCFF;">
        <tr style="background-image: url('/images/管理员页面/title_bg1.jpg'); background-repeat: repeat-x;">
            <td style="font-weight: bold; font-size: large; font-family: 仿宋;">
                <strong>【管理员权限管理】</strong>
            </td>
        </tr>
    </table>
    <table class="editTable" cellpadding="0px" cellspacing="1px">
        <tr>
            <th>
                管理员角色
            </th>
            <td>
                <asp:DropDownList ID="drpAdminRole" runat="server" AutoPostBack="true" OnSelectedIndexChanged="drpAdminRole_SelectedIndexChanged">
                </asp:DropDownList>
                <a target="_blank" href='/Admin/AminRole/Manage.aspx'>添加管理员角色</a>
            </td>
        </tr>
    </table>
    <br />
    <table class="editTable" width="100%" cellpadding="0px" cellspacing="1px">
        <tr>
            <th valign="top">
                管理员权限
            </th>
            <td align="left" style="width: 95%">
                <table style="width: 100%;">
                    <asp:Repeater ID="rptRootNava" runat="server" OnItemDataBound="rptRootNava_ItemDataBound">
                        <ItemTemplate>
                            <tr>
                                <td>
                                    <input id="<%#Eval("ID")%>" type="checkbox" onclick='checkAll(<%#Eval("ID")%>)' /><%#Eval("Title") %>
                                    <div id="<%#Eval("ID")%>div" style="padding-left: 20px;">
                                        <asp:HiddenField ID="hdlID" Value='<%#Eval("ID") %>' runat="server" />
                                        <asp:Repeater ID="rptParNava" runat="server" OnItemDataBound="rptParNava_ItemDataBound">
                                            <ItemTemplate>
                                                <div style="width: 400px; float: left">
                                                    <input id="<%#Eval("ID")%>" type="checkbox" value="<%#Eval("ID")%>" onclick='checkAll(<%#Eval("ID")%>)' /><%#Eval("Title")%>
                                                    <div id="<%#Eval("ID")%>div" style="padding-left: 20px;">
                                                        <asp:HiddenField ID="hdlID" Value='<%#Eval("ID") %>' runat="server" />
                                                        <asp:Repeater ID="rptNava" runat="server">
                                                            <ItemTemplate>
                                                                <input id="<%#Eval("ID")%>" type="checkbox" name="cb" value="<%#Eval("ID")%>" /><%#Eval("Title")%>
                                                            </ItemTemplate>
                                                        </asp:Repeater>
                                                    </div>
                                                </div>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <hr />
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </table>
                <script type="text/javascript">
                    setTimeout(ReturnNavaChek, 0);
                </script>
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
            <td>
                <asp:Button ID="btnSubmit" OnClientClick="GetAll();" runat="server" Text="提交" Height="21px"
                    OnClick="btnSubmit_Click" />
            </td>
        </tr>
    </table>
    <asp:HiddenField ID="hdlNavaAll" runat="server" />
</asp:Content>
